import React, { createContext } from 'react';
//添加全局配置
export interface ConfigConsumerProps {
  getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => string;
}

export const configProviderDefault = {
  getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => {
    if (customizePrefixCls) return customizePrefixCls;

    return suffixCls ? `grui-${suffixCls}` : 'grui';
  },
};

const ConfigContext = createContext<ConfigConsumerProps>(
  // We provide a default function for Context without provider
  configProviderDefault,
);

export default ConfigContext;
